#define _CRT_SECURE_NO_WARNINGS	

#include<stdio.h>

void Swap(int* x, int* y)
{
    int tmp = *x;
    *x = *y;
    *y = tmp;
}

void Bubble_Sort(int arr[],int len)
{
    for (int i = len - 1; i > 0; i--)
    {
        bool flag = false;
        for (int j = 0; j < i; j++)
            if (arr[j] > arr[j + 1])
            {
                Swap(&arr[j], &arr[j + 1]);
                flag = true;
            }
        if (!flag)
            break;
    }

}

int main()
{
    int arr[10] = { 10,9,8,7,6,5,4,3,2,1 };
    Bubble_Sort(arr, 10);
    for (int i = 0; i < 10; i++)
        printf("%d ", arr[i]);
    return 0;
}